﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OrderingSystem.Domain
{
    public class LineItem : Entity<LineItem>
    {
        public Order Order { get; set; }
        public Product Product { get; set; }
        public int Quantity { get; set; }
        public decimal UnitPrice { get; set; }
        public decimal Discount { get; set; }

        public LineItem(Order order, int quantity, Product product)
        {
            Order = order;
            Quantity = quantity;
            Product = product;
            UnitPrice = product.UnitPrice;

            if (quantity >= 10)
            {
                Discount = 0.05m;
            }

        }
    }
}
